Copyright: A. Koot, 1994
Citation: Copycode helps you too


Index
Copycode index

Using Copycode:

Copying code

Copycode on screen

Opening files

Closing Copycode

Using the utilities:

CodeAdvisor

CodePrinter

Make-Lib

Spy:FRX

CodeCrosser

See also:

Installing Copycode

About Copycode

Revision history

About this helpfile


Copycode

One problem of VB is that you can only use one project at a time. If (like me) you have a lot of projects with great functions that you would like to use in a new project, there is always the possibility of adding the source file that contains the code you need. That would, however, leave you with a lot of unneeded functions. And this works only if you don't already have a duplicate procedure name or form name in the project.

Well, ok, you could try Notepad, or MS-Write, but that would leave you with a lot of unneeded code (your forms descriptions). Notepad can also only edit 32Kb, not enough for the more complicated forms files.

Copycode comes to your rescue. It allows you to open a second project next to your VB environment. From this new Copycode environment you can search your code (find all procedures file by file, or do a global search of your project) and copy all code you need. And you can even open a second or third instance of Copycode (available memory allowing).

When you are editing a project in VB, Copycode allows you to check on your project in several ways. First it can show you project information. Next it can make a cross reference of your code. Finally you can find out which of the procedures in your project are not needed anyway in order to optimize your project by using CodeAdvisor.

When you're done editing a project, the Codeprinter function allows you to print the source code in a structured manner.


CodeAdvisor

Optimizing your source code

The advantage of reusing sourcecode from existing projects (by using existing forms or modules) is that you can do less extra work. The disadvantage is that you could end up with a lot of code you actually do not need. So, CodeAdvisor was built for you.

CodeAdvisor reads your code and checks for procedures, constants and declarations that are never actually called. When it finds these, CodeAdvisor creates a report on screen, mentioning all these procedures, constants and declarations. CodeAdvisor never touches your code.

The report is saved (as an Ascii text) in the Copycode directory and shown in an edit window in Copycode.

You may print this text file from the File-Print menu.

CodeAdvisor doesn't look for procedures with an Underscore character (it might be an custom event not known by Copycode or myself for that matter).

If CodeAdvisor finds an obsolete procedure and you decide to delete it, I advise you to rerun CodeAdvisor: there could be constants or calls to procedures that are no longer present in your project after deleting the procedure.

Before actually deleting anything, be sure to make a back-up of your project. I tested this function, but I will not accept any claims for lost code...

You can find CodeAdvisor after loading a Project. It is situated in the Options menu. I even created this nice button [image] for it.

See also: Problems


CodePrint

Printing your source code

CodePrinter enables you to obtain a hard copy of the source code of the project you opened in Copycode. CodePrinter can be found in the Options menu.

Codeprinter formats your text in a simple, but efficient way: Every Module or Form is printed on a new page. Procedures and functions are printed in a bold typeface. There is no way (yet) to add a personal touch or to print single files.

After printing the final page of source code CodePrinter prints an alphabetical summary of all procedures and functions, with the module name and pagenumber where each procedures is printed.

You may find this option in the File-Print menu.

Be ware of the amount of paper needed:

sample project# 	1	2	3

source size (by Copycode)	6150	75839	204133

forms and modules	1	14	19

number of pages	5	66	152

(page size 11")


MakeLib
Make-Lib

Create a personal VB library

Make-Lib can be used to copy often used procedures into a single library file that you can add to a project.

Highlight a procedure in the right-hand listbox (the regular, not control-bound one).

Press the right hand mouse button and choose the To-Library option.

That's all folks.

To save your library, choose the Save library option beyond the File menu.

To reload the library: Open Library.

Note: After loading a library: DO NOT choose CodeAdvisor, that would result in loads of unneeded code (depending on your library size).


SpyFrx
Spy:Frx

Copying graphics files data

When all VB-forms are saved as Ascii, VB creates FRX files, that contain the graphics information from the forms. This includes the Forms-Icon and all icons and bitmaps in Picturebox controls and Image controls. By using the Spy:FRX functions it is possible to read these graphics.

After opening an FRX file, Copycode reads the file and displays the information in the two listboxes in the main window. The lefthand listbox shows all BMP's and WMF's. The righthand listbox shows all Icons within the FRX file. The names shown are fictional.

By choosing one of these graphics names, the relevant graphic is shown.

At this time you can choose to:

copy a BMP or WMF to clipboard (by pressing the Copy-button or Menu Edit-Copy)

save a BMP (choose from the File menu the Save Bitmap option)

save an icon (choose from the File menu the Save Icon option)

After using Copycode in the Spy:FRX mode you have to close the Spy:FRX window to continue using CopyCode in the Copycode mode.

When in Spy:FRX mode, you can only access *.FRX files from the file open icon.

Spy:FRX is available seperately as VBSPY.ZIP on several CD-ROMS.


Cross Reference

CodeCrosser enables you to create a cross reference of the procedures and functions in your project.

CodeCrosser creates a file in which all procedures are mentioned that are used in your project. It shows in which sub or function (of whatever module) it is called. It is usefull in debugging and streamlining your project.

Procedures in forms are searched for in the form itself.

Procedures in all other modules are searched for in all files of the project.

CodeCrosser creates an Ascii-file with the extension XFR in the Copycode directory and loads this file in a Copycode window (provided that the size is under 32Kb).

You may print this text file from the File-Print menu.

You can find CodeCrosser in the Options menu from the Copycode main window.

See also: Problems


Loading Files
Opening Files

After choosing the File-Open command (either from the menu or by clicking the FileOpen icon) the Windows common open file dialog appears. Standard file-extensions are *.MAK, *.BAS and *.FRM. By choosing a *.MAK file you open all relevant *.BAS and *.FRM files.

You can also open *.FRX files. In this case Copycode reads the information from the FRX file.

You can also open a file from the recent-files menu within the File-menu. Copycode remembers the last 4 projects/files you opened. These files are read from the Copycode.ini file (in your Windows subdirectory).

Every file is presented in its own window in Copycode. When loading a project, you can access any file from the Copycode Project window.

After opening all relevant files, the source code of the first procedure is shown in its window.

BTW:

for Copycode to work properly, you must to save all VB source files as Ascii files. Only then will Copycode read the file. You can save these files from the VB File - Save As menu, by checking the Save As Text checkbox. Once a file is saved as an Ascii file, you do not have to worry about it anymore.

Also choose Save as Text as the default option for VB. You may find this option under Options - Environment - Default Save As Format - choose Text instead of Binary. After that all new files are saved as Ascii as standard and all graphics forms information is saved in *.FRX files.

Spy:FRX:

After opening a FRX file, the file-open common dialog box (accessible form the file-open icon) only shows FRX forms, so that you can look for graphics files somewhat quicker. Only after closing this Spy:FRX window, all file formats are available again.


Source window

All source code is shown in the edit window. In this window you can use a Quick menu to access the options from the Edit menu a bit faster.

You can Select all text, Copy, Cut and Paste text in this editor.

There is just one limit to the size of the text:

The editor is a regular multiline VB Textbox, so only 32 Kb of text is allowed in the editor. There are, however, as much textboxes available as the project has files and even more code is available fromthe listboxes.


Copy Cut 'n Paste
Cut 'N Paste

Just like all Windows programs Cut, Copy and Paste can be chosen from the Edit menu or by clicking one of the icons in the buttonbar (only when a file is available).

There is no Save-file option, so you can only use Paste and Copy for reorganising your files prior to copying a large amount of code.

Once in a sourcecode window, you can reach a quick-menu by pressing the righthand mouse button, which allows for cut, copy, paste and Select all Text actions. Choose Select all text and then Copy to copy all of the procedure.

Should you cut or paste the wrong pieces of text, then there is an Undo facility, accessible from the edit menu.


Finding Text

There is a Find text option (within the Edit menu). After pressing the Find-button in the Find-window, Copycode will show a listbox with all the procedures that contain the text you're looking for.

Double_clicking on one of these routines lets you see the procedure. The text you searched for is highlighted. You can of course select all text and copy and paste the text, these functions are available form the edit menu in the find window.

By keeping open the listbox containing the referenced text after double_clicking a line, you can access multiple instances of the text.


Procedure listboxes

The procedure listboxes are shown in the main window.

Copycode mode:

From these listboxes you can choose the procedure that you wish to see. In the lefthand listbox all event driven procedures (coupled to VB objects) are shown.

In the righthand one all user created procedures are shown.

Spy:FRX mode:

In these listboxes the names of graphics are shown. The lefthand listbox shows all BMP and WMF type graphics. The righthand listbox shows all Icons (including Form-Icons).


Project Information

Copycode shows:

Project information: shows statistical information about your project. The indicated number of Constants and delarations shows a question mark unless you run CodeAdvisor. The indicated number of Lines of Code does not count the number of blank lines.

The Make-file: You guessed it

About...: Copyright information and registration details.

This information is available form the File-menu in the main screen.


Closing Copycode

You can close Copycode by choosing Close from the File-menu in the main screen. You can of course unload Copycode in the regular Windows fashion.


Screen layout
Fonts and Colors

Copycode has the option to change the font and color in a child window. By choosing a small font, you can view more code on a line.

Choose Font or Color from the Options menu and play for a while.

Check All Windows from this menu prior to choosing a font or color to change the font and / or color in all windows in one go.

You can save the global font / color via the Preferences submenu.


Screen positioning

You can decide where Copycode and its Project window are to be positioned on screen. Once Copycode is at the desired place choose Save Screen Position from the Preferences sub menu in the Options menu in the main window.


Installing Copycode
Installing

In order to use Copycode you do need to have:

VBRUN300.DLL (not included, as it belongs to VB 3.0)

CMDIALOG.VBX (not included)

COMMDLG.DLL (not included)

in your \windows\system directory or in the directory that contains Copycode.exe.

Copycode creates a .INI file in your \windows directory (it contains the 4 most recent files you edited in Copycode, screen position and registration information when registered).

This helpfile should be installed in the same directory as Copycode.exe, so that pressing [F1] in Copycode shows context sensitive help.


CopyCode Limits

Copycode has a limit of 32 Kb per procedure (due to the limit for VB Text-boxes) and a limit of 60 Kb for the global declarations area of any form or module (due to a built-in limit in Copycode. Visual Basic allows for 64Kb).


Thanx
Thanks

Several Code Copyiers deserve thanks for their support and ideas. So, thanks to:

Bradley O'Keefe

Guy Verville

Chris Velazquez

Larry Rebich

Joe Kane

Also, of course, thanks to MicroSoft for creating Visual Basic and not including Copycode!


About Copycode
About Copycode and Disclaimer

DISCLAIMER AND AGREEMENT

Users of Copycode must accept this disclaimer of warranty. If you do not accept this disclaimer, do not use the program.

COPYCODE IS SUPPLIED AS IS. THE AUTHOR DISCLAIMS ALL WARRANTIES,

EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR ANY PURPOSE. THE AUTHOR ASSUMES NO LIABILITY FOR DAMAGES, DIRECT OR CONSEQUENTIAL, WHICH MAY RESULT FROM THE USE OF COPYCODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

THE LICENCE AGREEMENT AND WARRANTY SHALL BE CONSTRUED, INTERPRETED AND GOVERNED BY THE LAWS OF THE NETHERLANDS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM ONE STATE TO ANOTHER.

Any person or organisation wanting to distribute COPYCODE for profit must first contact the author by post or email for authorisation.

Copyright for this software remains the property of:

André Koot

Compuserve address 100120,2360


Help Magician

This helpfile was created using the Help Magician, a tool by Software Interphase Inc. This tool provides most easy editing of helpfiles. No more need for an RTF-file editor and hard to learn tricks.


Registering Copycode

Copycode is shareware, and is provided at no charge to users for evaluation. Feel free to share it with your friends and colleagues, but please do not give it away altered or as part of another system. The essence of shareware software is to provide computer users with quality software without high prices, and at the same time to provide incentive for programmers to continue to develop new products.

If you find Copycode useful, and you are continuing to use it after the trial period of 60 days, you must make a registration payment as indicated in this section of this document. In return you will be given a user name, serial number and access code to disable the shareware reminder. This information will be good for all future shareware releases of Copycode. You will be informed when such releases become available.

To register your copy of Copycode send your name and address plus either a Cheque on an Dutch or English bank, Postgiro, Postal Order or International Money Order for the required sum, made payable to:

André Koot

Jan Nieuwenhuyzenstraat 54

4818 RK  Breda

The Netherlands

Pricing for Copycode is:

25 dutch guilders

10 english pounds

15 american dollars

for each and every copy

You may register Copycode through Compuserve in the SWREG forum: type Go SWREG and register ID 3357.

After registration is confirmed, you will be sent a serial number for Copycode and an access code via E-Mail. Enter these with your name in the registration form that is available from the About box in Copycode. These data will be written to the Copycode.ini file in your windows directory.

Please allow for 2 weeks delivery of the codes after registering.


CodeProblems

Two of the Copycode functions (CodeAdvisor and CodeCrosser) need to analyse your source code. They are not the most advanced in the world, so you may find this error:

Suppose your project contains a form with these procedures:

Sub testme (x as text)

Sub testmeproc (hello as integer)

CodeAdvisor may not report 'testme' as useless while it is never called, it will find testmeproc and assume that testme is needed.

CodeCrosser will announce 'testme' to be called by 'testmeproc' even when it is not called by Sub testmeproc.

So:

Don't trust this program for 100%, use your own judgement...

See also: Limits


Optimize

In most cases not all procedures and declared variables are really used. These data do cost a lot of resources. Removing this code could result in smaller executables.


Ascii

Visual Basic can save all source code as Ascii text. This code can thus be read by several utilities and edited using normal editors. Copycode needs this file format..


Global search

You can search for any text string in the project you opened in CopyCode


Quick menu

By pressing the right hand mouse button a quick menu appears. This menu offers the same options as the normal menus


Aboutbox
About copycode...

Copycode Copyright by André Koot, 1994


WMF's

Windows Meta File is a universal graphics file format for use within the MS Windows environment.


BMP's

BMP stands for BitMaP graphic. Every dot of the graphic is presented by its own bits.


FRX file format

FRX files are created when VB saves forms as ASCII code. These files contain all graphics information. You cannot normally read these files, but Spy:FRX enables you to look into them and copy the information.


RTF file format popup
RTF file format

The Rich Text Format was created by Microsoft to allow for exchanging text files on different platforms. Also it is used for creating Windows Helpfiles using the Microsoft Help Compiler.


XRef popup
Cross Reference

A cross reference shows all procedures (subs and functions) that are related to each other, i.e. by which sub or function a specific procedure is called.


Recent files

Copycode remembers the last 4 projects or files you opened. These files are accessible from the Files-menu. You can choose one of these files by pressing the underscored number in front of the filename.


Revision history

Release 4.5	 - Added: "_Timer" event

 - Added undo function in source windows

 - Changed several menu short cuts

 - Moved CodePrinter to new Print submenu in the File menu

 - CodeAdvisor now saves and shows text like CodeCrosser

 - New Preferences submenu (Options menu) includes saving your choice of font and color and (earlier feature) saving screen position

 - Created project window (a bit like the VB project window...) to access files. I removed the corresponding menu entry form the Window menu.

 - Made Spy:FRX more practical by only allowing *.FRX files to be opened from within this window.

 - Made a new toolbar (in color) that shows disabled state of buttons.

 - Turned this revision history upside down

Release 4.4	- Aboutbox shows version number again (it got lost somewhere when hiding the about-box and showing it again later).

- CodeCrosser now loads the XRF-file after checking (if less than 32Kb)

- Fixed a bug: Copycode went wrong in opening non ascii-files. In improving the performance I created this error.

Release 4.3	- Included CodeCrosser, Cross Reference option.

- Loading *.* files via Open file option.

- After loading a single file, you can load more files without closing the first one.

- Large Global files load more reliable. The max size is upped to 60 Kb.

- Removed the silly non printable character in declarations in forms in the textbox.

- Project information now shows the number of Lines of Code (not counting blank lines)

Release 4.2	- A bug in the Codeprinter procedure (I forgot Printer.EndDoc) fixed.

- Improved performance. Project loading now is 25% faster.

- Removed the file loading error messages.

- Better reliability, due to some recoding. Now Copycode keeps on loading procedures, when it used to stop and report a shortage of string space.

Release 4.1	- A bug in the file-load function was fixed. Copycode would not load a module that was situated in the higher directory of a project.

Release 4.0	- Included CodePrinter.

- Copycode now remembers its position on screen.

- Finding now not only highlights the found text, but also displays this part in the text box

Release 3.4:	- Moved CodeAdvisor menu to the Options-menu.

- Recoded CodeAdvisor so now it ought to handle Static and Private procedures as well as comma separated global declarations (i.e. Global var1, var2, var3) and multi dimensional arrays.

- You can minimize Copycode and all windows (including about etc.) in one go.

Release 3.3:	- Added Make-Lib option.

- An unknown bug in the registration form seems to be fixed unknowingly.

Release 3.2:	- Removed MDIChild.VBX.

- Removed the showing of empty declarations section of forms.

- Removed a bug: CodeAdvisor would advise to remove procedures of which the name ended with a Type declaration character while this character is not used in the calling of these procedures.

Release 3.1:	- Added project helpfile info in Project information window.

- Now shows the first procedure after loading.

- Change Font, Fontsize and color globally.

- Copycode Error 62: Now mentions that you should save as Ascii

- Removed a bug: Global-modules larger than 30K would not load, now CopyCode splits these files. At this moment loading 51K is possible.

Release 3.0:	Copycode is now shareware

- Spy:Frx (ability to copy graphics from FRX-files).

- CodeAdvisor.

- Project Info shows number of declarations and constants (after running CodeAdvisor).

- Recent files accessible via quick-keys (underscored numbers).

- Registration bits.

Release 2.2: 	 - Removed two more 'bugs'

  - inability to read files with a path different from the default path of the project (would result in an Error 64 message). It is almost the same error as fixed in 2.1, but I forgot to look at it, as I seldom create projects with shared modules.

  - Copycode didn't recognise the Gotfocus-event. It did find the Getfocus event, but that would never occur as this event doesn't exist.

 - Added: _Sel* event.

Release 2.1: 	- Removed two 'bugs':

 - inability to read single *.BAS and *.FRM files (error 64, invalid path).

 - Copycode now shows source code of the upper file in the listboxes after loading a project.

 - Added:

   Copycode now shows the number of subs and functions in the Project info window.

Release 2.0:	- Bye bye 32 Kb-limit

   (I killed the dutch language version too, to much effort)

Release 1.2:	- Includes a Recent-files option.

Release 1.1:	- Loads all files

Release 1.0.	- First release. There is also a version in the Dutch language.

Some bugs found and wishes sent in by see also


Bug popup
Bug

A bug is an unintentional error in the program. It was created by the programmer or it occurred due to other unknown forces. You should report any error to the publisher asap.


Event popup
Event

An event occurs when actions from outside the application result in an action by the application. In VB events are coupled to screen objects. All event-driven procedures are shown in the lefthand listbox in Copycode.


Project window

From this window (default on top) you can click on a file name to activate its source window. Press on the [View Code] button to view the main window by sending the project window to the background, or  you can minimize this window. When you reactivate the project window (either by clicking on it or by choosing menu Window-Project) it will stay on top again.

This function was built because several Code Copiers asked for better accessibility of the MDI source windows. I hope you like it !


Copycode Caption

This Caption bar shows the name of the project loaded in Copycode.


Copycode on screen

This is part of a regular Copycode screen. It shows my Copycode project (well, just in part).


MinimizeButton
CodeAdvisor button

This button calls the CodeAdvisor function.


FileOpen
File open button

This button allows you to open a new project or file


Edit buttons

These buttons provide access to the Windows Cut Copy and Paste functions


Listboxes

These Listboxes allow you to choose from the procedures within a file, or (in Spy:FRX mode) to choose a graphic from an FRX file.


Project Window

This window is the Copycode equivalent of the Visual Basic project window.


WinSystem
Windows System boxes

These buttons provide the regular Windows functions.


MDIWindows
Copycode source windows

These windows show the source code within the file mentioned in the caption bar of each window.


View Code

This button sends the project window to the background, so that you can inspect all windows.